package view;

import java.awt.BorderLayout;
import java.awt.Dialog;
import java.awt.Dimension;

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;


import javax.swing.JButton;
import javax.swing.JDialog;

import javax.swing.JTable;

public class Highscore extends JDialog implements ActionListener{

	private static final long serialVersionUID = 1L;
	private JTable table;
	private JButton ok;
	
	
	public Highscore(Mario hauptfenster){
		super(hauptfenster,"Highscore",Dialog.ModalityType.APPLICATION_MODAL);	

		this.setLayout(new BorderLayout());
		
		
		String[] columnNames = {"Platz","Name", "Score"};
		Object[][] data = { {"1", "Nico", new Integer(10000000)},
							{"2", "Nico", new Integer(100000)}
		
		
						  };
		
		HighscoreTable x = new HighscoreTable(columnNames,data);
		
		this.table = new JTable(x);
		this.add(table.getTableHeader(), BorderLayout.PAGE_START);
		this.add(table, BorderLayout.CENTER);
		
		this.ok = new JButton("ok");
		this.ok.addActionListener(this);
		this.ok.setPreferredSize(new Dimension(10,50));
		this.add( this.ok, BorderLayout.SOUTH);
		
		//this.setResizable(false);
		this.pack();
		this.setVisible(true);
	}



	public void actionPerformed(ActionEvent arg0) {
		
		if(arg0.getSource() == this.ok){
			this.setVisible(false);
			this.dispose();
		}
		
	}

}
